package org.fastsyncer.parser;

import org.fastsyncer.connector.config.Filter;
import org.fastsyncer.listener.config.ListenerConfig;
import org.fastsyncer.parser.convert.FieldConvert;
import org.fastsyncer.plugin.config.Plugin;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * 驱动映射关系
 * @author AE86
 * @version 2.0.0
 * @date 2019/10/1 13:19
 */
public class Mapping {

    // 驱动ID
    private String id;

    // 映射名称
    private String name;

    // 数据源连接器ID
    private String sourceConnectorId;

    // 目标源连接器ID
    private String targetConnectorId;

    // 表关系映射,["tableGroupId_0","tableGroupId_1","tableGroupId_999"]
    private List<String> tableGroup;

    // 过滤条件
    private Filter filter;

    // 字段转换
    private List<FieldConvert> fieldConvert;

    // 插件策略
    private Plugin plugin;

    // 监听配置
    private ListenerConfig listener;

    // 每次执行任务总数
    private int maxNum = 10000;

    // 每次批量执行数
    private int batchNum = 200;

    // 线程数
    private int threadNum = 5;

    // 创建时间
    private String createDateTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

    // 修改时间
    private String updateDateTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));

    public String getId() {
        return id;
    }

    public Mapping setId(String id) {
        this.id = id;
        return this;
    }

    public String getName() {
        return name;
    }

    public Mapping setName(String name) {
        this.name = name;
        return this;
    }

    public String getSourceConnectorId() {
        return sourceConnectorId;
    }

    public Mapping setSourceConnectorId(String sourceConnectorId) {
        this.sourceConnectorId = sourceConnectorId;
        return this;
    }

    public String getTargetConnectorId() {
        return targetConnectorId;
    }

    public Mapping setTargetConnectorId(String targetConnectorId) {
        this.targetConnectorId = targetConnectorId;
        return this;
    }

    public List<String> getTableGroup() {
        return tableGroup;
    }

    public Mapping setTableGroup(List<String> tableGroup) {
        this.tableGroup = tableGroup;
        return this;
    }

    public Filter getFilter() {
        return filter;
    }

    public Mapping setFilter(Filter filter) {
        this.filter = filter;
        return this;
    }

    public ListenerConfig getListener() {
        return listener;
    }

    public Mapping setListener(ListenerConfig listener) {
        this.listener = listener;
        return this;
    }

    public List<FieldConvert> getFieldConvert() {
        return fieldConvert;
    }

    public Mapping setFieldConvert(List<FieldConvert> fieldConvert) {
        this.fieldConvert = fieldConvert;
        return this;
    }

    public Plugin getPlugin() {
        return plugin;
    }

    public Mapping setPlugin(Plugin plugin) {
        this.plugin = plugin;
        return this;
    }

    public int getMaxNum() {
        return maxNum;
    }

    public Mapping setMaxNum(int maxNum) {
        this.maxNum = maxNum;
        return this;
    }

    public int getBatchNum() {
        return batchNum;
    }

    public Mapping setBatchNum(int batchNum) {
        this.batchNum = batchNum;
        return this;
    }

    public int getThreadNum() {
        return threadNum;
    }

    public Mapping setThreadNum(int threadNum) {
        this.threadNum = threadNum;
        return this;
    }

    public String getCreateDateTime() {
        return createDateTime;
    }

    public Mapping setCreateDateTime(String createDateTime) {
        this.createDateTime = createDateTime;
        return this;
    }

    public String getUpdateDateTime() {
        return updateDateTime;
    }

    public Mapping setUpdateDateTime(String updateDateTime) {
        this.updateDateTime = updateDateTime;
        return this;
    }
}
